/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package dawnland03.data.map.model;

/**
 * @author Petru Obreja (obrejap@yahoo.com)
 */
public enum MatrixDirection {
    UP(0),
    RIGHT_UP(1),
    RIGHT(2),
    RIGHT_DOWN(3),
    LEFT_DOWN(4),
    LEFT(5),
    LEFT_UP(6);

    private final int order;

    private MatrixDirection(int order) {
        this.order = order;
    }

    public int getOrder() {
        return order;
    }
    
    public static MatrixDirection getMatrixDirection(int order){
        for(MatrixDirection matrixDirection : MatrixDirection.values()){
            if(matrixDirection.getOrder() == order){
                return matrixDirection;
            }
        }
        return null;
    }

    public MatrixDirection getOpposite(MatrixDirection matrixDirection){
        if(matrixDirection == MatrixDirection.UP){
            return null;
        }
        return MatrixDirection.getMatrixDirection(7-matrixDirection.getOrder());
    }

}
